<template>
  <div class="personal-center">
    <!-- 左侧容器 -->
    <div class="left-container">
      <!-- 添加头像过渡动画 -->
      <transition name="fade">
        <div class="avatar-container">
          <img src="@/assets/logo1.png" alt="APPlogo" class="avatar" />
        </div>
      </transition>

      <div class="nav-container">
        <!-- 为导航链接添加悬停动画 -->
        <router-link to="/Index" class="external-link">
          <i class="el-icon-house"></i>
          {{$t('personal_center_nav.home')}}
        </router-link>
        <!-- 其他导航链接保持不变 -->
        <router-link to="/Forum" class="external-link">
          <i class="el-icon-chat-line-square"></i>
          {{$t('personal_center_nav.forum')}}
        </router-link>
        <router-link to="/basic-info" active-class="active">
          <i class="el-icon-user"></i>
          {{$t('personal_center_nav.basicInfo')}}
        </router-link>
        <router-link to="/health-record" active-class="active" exact-active-class="active">
          <i class="el-icon-document"></i>
          {{$t('personal_center_nav.healthRecord')}}
        </router-link>
        <router-link to="/Systeminfo" active-class="active">
          <i class="el-icon-chat-dot-square"></i>
          {{$t('personal_center_nav.interaction')}}
        </router-link>
        <router-link to="/medical-service" active-class="active">
          <i class="el-icon-first-aid-kit"></i>
          {{$t('personal_center_nav.medicalService')}}
        </router-link>
        <router-link to="/feedback" active-class="active">
          <i class="el-icon-question"></i>
          {{$t('personal_center_nav.feedback')}}
        </router-link>
        <router-link to="/Setup" active-class="active">
          <i class="el-icon-setting"></i>
          {{$t('personal_center_nav.setup')}}
        </router-link>
      </div>
    </div>

    <!-- 右侧内容显示区域，添加路由视图过渡动画 -->
    <transition name="slide-fade">
      <div class="right-container">
        <router-view></router-view>
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  name: 'PersonalCenter',
};
</script>

<style scoped>
.personal-center {
  display: flex;
  min-height: 100vh;
}

.left-container {
  width: 200px;
  /* 修改为蓝色渐变背景 */
  background: linear-gradient(0deg, #eae8f1 0%, #eae8f1  20%, #3e92cc 60%, #eae8f1  100%) !important;
  padding: 20px;
  box-shadow: 4px 0 10px rgba(0, 0, 0, 0.2); 
  border-radius: 0 10px 10px 0;
}

.avatar-container {
  text-align: center;
  margin-bottom: 20px;
  border: 3px solid #ffffff;
  padding: 15px;
  border-radius: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  /* 使用浅蓝色作为头像容器背景色，与导航蓝色渐变协调 */
  background-color: #90b7d9; 
}

.avatar-container:hover {
  transform: scale(1.05); /* 悬停时放大 */
}

.avatar {
  width: 100px; /* 增大头像尺寸 */
  height: 100px;
  border-radius: 50%;
  border: 3px solid #ffffff; /* 更改头像边框颜色 */
}

.nav-container {
  display: flex;
  flex-direction: column;
}

.nav-container a {
  margin-bottom: 15px; /* 增加导航链接间距 */
  text-decoration: none;
  color: #ffffff; /* 更改导航链接文字颜色 */
  font-size: 18px; /* 增大字体大小 */
  padding: 12px 15px; /* 增加内边距 */
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.nav-container a i {
  margin-right: 12px; /* 增加图标与文字间距 */
  width: 24px;
  text-align: center;
  font-size: 20px; /* 增大图标尺寸 */
}

.nav-container a:hover {
  background-color: rgba(255, 255, 255, 0.2); 
  color: #ffffff;
  transform: translateX(8px); 
}

.nav-container a.active {
  background-color: rgba(255, 255, 255, 0.3); 
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); 
}

.right-container {
  flex: 1;
  padding: 30px; /* 增加内边距 */
  background-color: #f5f5f5; /* 更改背景颜色 */
  border-radius: 10px 0 0 10px; /* 添加圆角 */
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}

/* 头像过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

/* 路由视图过渡动画 */
.slide-fade-enter-active {
  transition: all 0.3s ease-out;
}
.slide-fade-leave-active {
  transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter-from,
.slide-fade-leave-to {
  transform: translateX(20px);
  opacity: 0;
}
</style>



